<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8"/>
    <title>BlackNOTA</title>
    <link rel="stylesheet" type="text/css" href="/webjars/layui/1.0.7/css/layui.css"></link>
</head>
<body style="background: url('/asset/img/bg-login01.jpg') no-repeat;background-size:cover;">
<div>
    <div style="margin-left: 5%;margin-top: 5%">
    <img src="/asset/img/logo.png" height="20%" width="20%">
</div>
<div style="text-align: center">
    <div style="width: 40%;height: 30%;margin:10% auto;background-color: white;opacity: 0.5;border-radius:25px;-moz-border-radius:25px;">
    <div style="width: 80%;margin:5% auto;" >
        <div>
            <p class="text-center"><span style="color:black;font-size: 50px">BlackNOTA</span></p>
        </div>
        <br/>
        <form class="layui-form" method="post" action="/user/login">
            <div class="layui-form-item">
                <input id="username" type="text" name="username" lay-verify="required" autocomplete="off" placeholder="请输入用户名" class="layui-input"/>
            </div>
            <div class="layui-form-item">
                <input id="password" type="password" name="password" lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input"/>
            </div>
            <div class="layui-form-item">
                <button class="layui-btn" lay-submit="" lay-filter="login" style="width: 100%">登录</button>
            </div>
        </form>
    </div>
    </div>
</div>
    <!--<div style="text-align: center;"><p style="color: white">CopyRight © 2018 国药控股天津有限公司 All Rights Reserved</p></div>-->
</div>
<script type="text/javascript" src="/webjars/layui/1.0.7/layui.js"></script>
<script type="text/javascript" src="/webjars/jquery/3.3.1/jquery.min.js"></script>
<script>
    layui.use(['form'], function () {
        var form = layui.form();
        //监听提交
        form.on('submit(login)', function(data) {
            $.post({
                url:data.form.action,
                data:{
                    username:data.field.username,
                    password:data.field.password
                },
                success:function (json) {
                    var status = json.status;
                    if(status==200){
                        window.location.href = "/";
                    }else{
                        layer.msg(json.msg);
                    }
                },
                error: function(data) {
                    layer.msg("网络错误");
                }
            });
            return false;
        });
    });
</script>
</body>
</html>